/*Copyright 2014 Douglas Soares

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 */
package br.ds.twitter4a.rest.util;

import java.util.Locale;

/**
 * Enumerated that defines OAuth attributes given by its key, value pair.
 */
public enum OAuthAttrs {

    OAUTH_CALLBACK {
	@Override
	public String value() {
	    return ConsumerKeys.CALLBACK;
	}
    },

    OAUTH_CONSUMER_KEY {
	@Override
	public String value() {
	    return ConsumerKeys.CONSUMER_KEY;
	}
    },

    OAUTH_VERSION {
	@Override
	public String value() {
	    return "1.0";
	}
    },

    OAUTH_NONCE {
	@Override
	public String value() {
	    return OAuthUtils.getNonce();
	}
    },

    OAUTH_TIMESTEMP {
	@Override
	public String value() {
	    return OAuthUtils.getTimestamp();
	}
    },
    SIGNATURE_METHOD {
	@Override
	public String value() {
	    return "CMAC-AES";
	}

	@Override
	public String key() {
	    return "oauth_signature_method";
	}
    };

    /**
     * @return the OAuht key used to perform a request.
     */
    public String key() {
	return this.name().toLowerCase(Locale.US);
    }

    /**
     * @return the value associated to the <code>this</code> enumerated.
     */
    public abstract String value();
}
